package com.seata.demo.cloud.client;

import com.seata.demo.cloud.dto.AccountDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "seata-cloud-account",path = "/account")
public interface AccountClient {

    @PostMapping("/reduceBalance")
    boolean reduceBalance(@RequestBody AccountDTO accountDTO) throws Exception;

    @PostMapping("/reduceBalanceTCC")
    boolean reduceBalanceTCC(@RequestBody AccountDTO accountDTO) throws Exception;

    @GetMapping("/getBalance")
    Integer getBalance(@RequestParam("userId") Long userId) throws Exception;
}
